﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using BOSS.Framework.Search.Context;

namespace BOSS.Framework.Search.Result
{
    /// <summary>
    /// 搜索结果接口
    /// </summary>
    public interface ISearchResult
    {
        /// <summary>
        /// 获取 搜索上下文
        /// </summary>
        ISearchContext SearchContext { get; }

        /// <summary>
        /// 获取 内容类型
        /// </summary>
        string ContentType { get; }

        /// <summary>
        /// 获取 结果总数
        /// </summary>
        int TotalCount { get; }

        /// <summary>
        /// 获取 分页大小
        /// </summary>
        int PageSize { get; }

        /// <summary>
        /// 获取 分页的页序号，下标从 1 开始
        /// </summary>
        int PageIndex { get; }

        /// <summary>
        /// 获取 当前页的条目数
        /// </summary>
        int PageCount { get; }

        /// <summary>
        /// 获取 当前页的结果条目集合
        /// </summary>
        IEnumerable<IResultItem> Items { get; }

        /// <summary>
        /// 获取 当前页的底层结构条目集合
        /// </summary>
        IEnumerable<object> UnderlayerItems { get; }

        /// <summary>
        /// 获取 错误信息
        /// </summary>
        string ErrorMessage { get; }

        /// <summary>
        /// 过滤结果条目
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        ISearchResult Filter(Func<object, bool> filter);

        /// <summary>
        /// 过滤结果条目
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        ISearchResult Filter(Func<IResultItem, bool> filter);
    }
}
